import { request } from "@/utils/service"
import {TableColumnCtx} from "element-plus";
type ResponseData = ApiResponseData<{
  list: Object
  total: number
}>

interface searchParams {
  startTime?: number
  endTime?: number
}

interface WorkOrder {
  workType: string
  total: number
  done: number
  todo: number
  closedloop: string
}

export interface Task {
  title: string
  vipLevel: string
  owner: string
  status: string
}

export interface SummaryMethodProps<T = WorkOrder> {
  columns: TableColumnCtx<T>[]
  data: T[]
}

export interface SpanMethodProps {
  row: problemsFailures
  column: TableColumnCtx<problemsFailures>
  rowIndex: number
  columnIndex: number
}

export interface problemsFailures {
  total: number
}

export interface SpanMethodProps {
  row: problemsFailures
  column: TableColumnCtx<problemsFailures>
  rowIndex: number
  columnIndex: number
}

export function getCustomerAnalysisDataApi() {
  return request<ResponseData>({
    url: "/customer/analysis",
    method: "get"
  })
}

export function getEnvDataApi(params: searchParams) {
  return request<ResponseData>({
    url: "/customer/envAnalysis",
    method: "get",
    params
  })
}


export function getWorkOrderDataApi(params: searchParams) {
  return request<ResponseData>({
    url: "/customer/workOrder",
    method: "get",
    params
  })
}
